package  
{
  import flash.display.Sprite;
  import flash.events.Event;
	/**
   * ...
   * @author ivan
   */
  public class SelectCommand implements Command
  {
    
    public function SelectCommand(graphStage:GraphStage, sprite:Sprite) 
    {        
      this.sprite = sprite;
      
      redo();
    }
    
    public function undo():void
    {
      var index:int = Selection.items.indexOf(sprite);
      if (index != -1)
        Selection.items.splice(index, 1);
    }
    
    public function redo():void
    {
      if (Selection.items.indexOf(sprite) == -1)
        Selection.items.push(sprite);
    }
    
    private var sprite:Sprite;
    
  }

}